package com.example.controller;

import com.example.bean.Student;
import com.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

//控制器
//url :http://localhost:8077/findAll
@RestController
public class UserController {

    @Autowired //他说就是到内存中找到对象
    UserService userService;

    @GetMapping("/findAll")
    public List<Student> findAll() {
        return userService.findAll();
    }


    @GetMapping("/findById")
    public Student findById(Integer id) {
        return userService.findById(id);
    }



}
